
/*
	Author: Genesis

	Description:
		This function will monitor all placed Vcom mines. Better than each mine having its own spawn.

	Parameter(s):
		NONE

	Returns:
		NOTHING
*/

//This list is all local.
while {true} do {
	private _RemoveLst = [];
	{
		private _Mine = _x select 0;
		if (alive _Mine) then [{
			private _Side = _x select 1;
			private _EL = [];
			{
				if ([_Side, side _x] call BIS_fnc_sideIsEnemy) then {_EL pushback _x};
			} forEach allUnits;
			
			private _CE = [_EL,_Mine,true,"2"] call VCM_fnc_ClstObj;
			
			if (_CE distance _Mine < 2.5) then {
				if (!isNull _Mine && {!simulationEnabled _Mine}) then {[_Mine, true] remoteExecCall ["enableSimulationGlobal",2]}; //
				sleep .25;
				_Mine setDamage 1;
			};
		},{
			if (!isNull _Mine && {!simulationEnabled _Mine}) then {[_Mine, true] remoteExecCall ["enableSimulationGlobal",2]}; //k1 2020.12.19
			_RemoveLst pushback _x;
		}];
	} forEach VCOM_MINEARRAY;
	
	{
		private _A = _x;
		private _idx = -1;
		{if(_A isEqualTo _x)exitWith{_idx=_forEachIndex}} forEach VCOM_MINEARRAY;
		VCOM_MINEARRAY deleteAt _idx;
	} forEach _RemoveLst;
	sleep 1.25;
};